
<%@ page language="java"
	import="java.util.*,news.dao.*,news.pojo.*,news.util.*"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<title>新闻发布系统管理后台</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function souye() {
		location = 'home.jsp';
	}
</script>
<c:if test="${empty uname }">
		out.print("<script>alert('请先登录！');
			location = 'home.jsp';
		</script>");
		</c:if>
<div id="header">
	<div id="welcome">欢迎使用新闻管理系统！</div>
	<div id="nav">
		<div id="logo">
			<img src="images/logo.jpg" alt="新闻中国" onclick="souye()" />
		</div>
		<div id="a_b01">
			<img src="images/a_b01.gif" />
		</div>
	</div>
</div>
<div id="admin_bar">
	<%-- <%String uname=(String)session.getAttribute("uname");
String upwd=(String)session.getAttribute("upwd");
%> --%>
	<div id="status">
		管理员：${uname}欢迎您 &#160;&#160;&#160;&#160; <a href="dologoutServlet">退出登录</a>
		&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;
		&#160;&#160;&#160;&#160; <a href="addnews.jsp?opr=findTopics"
			style="color:blue ">添加新闻</a>&#160;&#160;&#160;&#160;
		&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;
		&#160;&#160;&#160;&#160; <a href="topic_add.jsp?opr=list">编辑主题</a>
	</div>
	<div id="channel"></div>
</div>
</head>
<body>

	<script type="text/javascript">
		function check() {
			var ntitle = document.getElementById("ntitle");
			var nauthor = document.getElementById("nauthor");
			var nsummary = document.getElementById("nsummary");
			var ncontent = document.getElementById("ncontent");
	
			if (ntitle.value == "") {
				alert("标题不能为空");
				ntitle.focus();
				return false;
			} else if (nauthor.value == "") {
				alert("作者不能为空");
				nauthor.focus();
				return false;
			} else if (nsummary.value == "") {
				alert("概述也不能为空");
				nsummary.focus();
				return false;
			} else if (ncontent.value == "") {
				alert("内容肯定不能是空白");
				ncontent.focus();
				return false;
			}
			return true;
		}
	</script>


	<div id="main">
		<div id="opt_list">
			<ul>

				</ul>
</div>

  <div id="opt_area">
    <h1 id="opt_type">编辑新闻 </h1>
   <form action="domodifynewsServlet?nid=${modnews.nid }" method="post" enctype="multipart/form-data" onsubmit="return check()">
      <p>
        <label> 主题 </label>
        <select name="ntid">
        <c:forEach items="${modtopics }" var="mt">
        <option value="${mt.tid }" ${mt.tid==modnews.ntid?"selected":""} >${mt.tname} </option>       
        </c:forEach>        	        	
        </select>
        <input type="hidden" name="nid" value="${modnews.nid }" />
      </p>
       <p>
        <label> 标题 </label>
        <input name="ntitle" id="ntitle" type="text" class="opt_input" value="${modnews.ntitle}"/>
      </p>
      <p>
        <label> 作者 </label>
     <input name="nauthor" id="nauthor" type="text" class="opt_input" value="${modnews.nauthor }"/>
      </p>
      <p>
         <label> 摘要 </label>
        <textarea name="nsummary" id="nsummary" cols="40" rows="3">${modnews.nsummary }</textarea>
      </p>
      <p>
        <label> 内容 </label>
        <textarea name="ncontent" id="ncontent" cols="70" rows="10">${modnews.ncontent}</textarea>
      </p>
      <p>
        <label> 上传图片 </label>
        <input name="file" id="file" type="file" class="opt_input" onchange="c()" value="" /><br/>
        <img src="${modnews.npicpath }" id="show" width="200" alt="网络不畅通，图片无法显示！！！">
        <br>
           <script>
  function c () {
  var r= new FileReader();
  f=document.getElementById('file').files[0];
   
  r.readAsDataURL(f);
  r.onload=function (e) {
    document.getElementById('show').src=this.result;
  };
}</script>
      </p>
      <input type="submit" value="提交" class="opt_sub" />
      <input type="reset" value="重置" class="opt_sub" /> 
    </form>

    <h1 id="opt_type">
		修改新闻评论：
	</h1>
               <table width="80%" align="center">
        	<td colspan="6"> 
			<ul class="classlist">
				<table width="80%" align="center">
					<td colspan="6"><c:choose>
							<c:when test="${empty modcomments }">
					暂无评论，快抢沙发！
					</c:when>
							<c:otherwise>
								<h3 style="color:green">神评榜:</h3>
								<c:forEach items="${modcomments }" var="clist" varStatus="s">
									<div>
										用户：<span style="color:red">${clist.cauthor}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										时间：<span style="color:orange"><fmt:formatDate value="${clist.cdate}" pattern="yyyy-MM-dd HH:mm"/></span>&nbsp;&nbsp;
										IP：<span style="color:purple">${clist.cip }</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<a href='delcommentsServlet?opr=del&delcid=${clist.cid }&nid=${modnews.nid }' style="color:brown ">删除</a>
									</div>
									<div>
										内容：<span style="color:blue">${clist.ccontent}</span>
									</div>
									<br>
									<hr>
								</c:forEach>

							</c:otherwise>
						</c:choose></td>
					<tr>
						<td colspan="6"><hr /></td>
					</tr>


				</table>
			</ul>

</div>

 <div id="footer">
  <div id="site_link"> <a href="#">关于我们</a><span>|</span> <a href="#">Aboue Us</a><span>|</span> <a href="#">联系我们</a><span>|</span> <a href="#">广告服务</a><span>|</span> <a href="#">供稿服务</a><span>|</span> <a href="#">法律声明</a><span>|</span> <a href="#">招聘信息</a><span>|</span> <a href="#">网站地图</a><span>|</span> <a href="#">留言反馈</a> </div>
<div id="footer">
  <p class="">24小时客户服务热线：010-68988888  &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a> &#160;&#160;&#160;&#160;  新闻热线：010-627488888<br />
    文明办网文明上网举报电话：010-627488888  &#160;&#160;&#160;&#160;  举报邮箱：<a href="#">jubao@jb-aptech.com.cn</a></p>
  <p class="copyright">Copyright &copy; 1999-2009 News China gov, All Right Reserver<br />
    新闻中国   版权所有</p>
</div>
</body>
</html>